#{extends 'main.html' /}
#{set title:'Questions overview' /}
#{set 'moreScripts'}
    <script src="@{'/public/javascripts/jquery.dataTables.min.js'}" type="text/javascript" charset="${_response_encoding}"></script>
    <script>
        $(document).ready( function() {
            oTable = $('.questionTable').dataTable( {
            							"bSearchable": false,
            							});
        });
    </script>
#{/set}

#{navigation /}

<div class="content">
		<h1>Questions Overview</h1>
	
	<div style="width: 80%; margin: auto">
		<table cellpadding="0" cellspacing="0" border="0" class="questionTable" id="questionTable">
			<thead>
			<tr><th>No</th><th>Title</th><th>Lecture</th><th>Votes</th></tr>
			</thead>
			<tbody>
			#{list questions, as:'question'}
				<tr><td>${question.id}</td><td><a href="@{Questions.show(question.id)}">${question.title}</a></td><td><a href="@{Lectures.show(question.lecture.id)}">${question.lecture.course.name}: ${question.lecture.name}</a></td><td align="center">${question.votes()}</td></tr></li>
			#{/list}
			</tbody>
		</table>
	</div>
</div>